<template>
  <div class="swiper-container">
    <!-- ref="mySwiper" @someSwiperEvent="callback" -->
    <swiper :options="swiperOption" v-if="swiperShow">
      <div class="swiper-pagination"  slot="pagination"></div>
      <!-- slides -->
      <swiper-slide v-for="item in list" :key="item.id"><img :src="item.imgUrl" alt="" class="swiper-img"></swiper-slide>
      <!-- Optional controls -->
      <!-- <div class="swiper-button-prev" slot="button-prev"></div>
      <div class="swiper-button-next" slot="button-next"></div>
      <div class="swiper-scrollbar"   slot="scrollbar"></div> -->
    </swiper>
  </div>
</template>
<script>
export default {
  name: "HomeSwiper",
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        loop: true,
        autoplay: true,
        speed:2500
      }
    };
  },
  props: {
    list: Array
  },
  computed: {
    swiperShow () {
      return this.list.length
    }
  }
};
</script>
<style lang="scss" scoped>
// .swiper-container >>> .swiper-pagination-bullet-active{
//     background: black !important;
// }
.swiper-container{
  width: 100%;
  height: 0;
  overflow: hidden;
  padding-bottom: 31.25%;
  background-color: #eee;
  .swiper-img {
    width: 100%;
  }
}
</style>
<style>
.swiper-container .swiper-pagination-bullet-active{
    background: #fff !important;
}
</style>



